$(function () {
	
	
	$("#YES").on('click', function () {
		var newpassword1 = $("#newpassword1").val();
		var newpassword2 = $("#newpassword2").val();
		var oldpassword = $("#oldpassword").val();
		if(newpassword1 == ""){
			alert("新密码不能为空！");
			return;
		}
		if(newpassword1 != newpassword2){
			alert("新密码两次输入不一致！");
			return;
		}
		var param = {oldpassword:oldpassword,newpassword:newpassword1};
		var url = pms_url + "sys/performance/changePassword"; 
		$.ajax({  
	        type : "post",  
	        url : url,  
	        dataType: "json", 
	        data : param, 
	        async : false,  
	        success : function(data){ 
		    		if(data.err_code=="0"){
		    			alert("修改成功！");
		    			window.location.href="../../logout.do";
		    		}else {
		    			alert("旧密码不正确！");
		    		}
	        	}
	        });			
	});	
	
	
	$("#NO").on('click', function () {
		$("#newpassword1").val("");
		$("#newpassword2").val("");
		$("#oldpassword").val("");
	});	
	
	
})